import axios from '../http'

const api = '/api/orders'

const error = (e) => {
    return () => console.error(e);
};

export function listOrders(cb, fcb = error('listOrders')) {
    axios.get(api).then(function (response) {
        cb(response.data);
    }, function (response) {
        var data = false;
        console.info(response);
        fcb(data);
    })
}

export function orderDetail(params, cb, fcb = error('orderDetail')) {
    axios.get(api + '/' + params.code).then(function (response) {
        cb(response.data);
    }, function (response) {
        var data = false;
        console.info(response);
        fcb(data);
    })
}
